//
//  HTbottomView.swift
//  mySinaBlog
//
//  Created by whtapple on 3/27/16.
//  Copyright © 2016 whtapple. All rights reserved.
//

import UIKit

class HTbottomView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        prepareUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    func prepareUI(){
        //添加子控件
        addSubview(leftBtn)
        addSubview(midBtn)
        addSubview(rightBtn)
        addSubview(separatorViewOne)
        addSubview(separatorViewTwo)
        //约束
        leftBtn.snp_makeConstraints { (make) -> Void in
            make.top.leading.bottom.equalTo(self)
        }
        
        midBtn.snp_makeConstraints { (make) -> Void in
            make.bottom.top.equalTo(self)
            make.leading.equalTo(leftBtn.snp_trailing)
            make.width.equalTo(leftBtn)
        }
        rightBtn.snp_makeConstraints { (make) -> Void in
            make.top.bottom.trailing.equalTo(self)
            make.leading.equalTo(midBtn.snp_trailing)
            make.width.equalTo(leftBtn)
        }
        separatorViewOne.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(leftBtn.snp_trailing)
            make.centerY.equalTo(leftBtn)
        }
        separatorViewTwo.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(midBtn.snp_trailing)
            make.centerY.equalTo(leftBtn)
        }
    }
    //懒加载
    private lazy var leftBtn: UIButton = UIButton(title: "转发", imageName: "timeline_icon_retweet")
    private lazy var midBtn: UIButton = UIButton(title: "评论", imageName: "timeline_icon_comment")
    private lazy var rightBtn: UIButton = UIButton(title: "赞", imageName: "timeline_icon_unlike")
    private lazy var separatorViewOne: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    private lazy var separatorViewTwo: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))

}

